package com.esri.core.tasks.na;

import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.Polygon;
import com.esri.core.geometry.Polyline;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.geometry.Unit;
import com.esri.core.internal.tasks.d.e;
import com.esri.core.map.Graphic;
import com.github.mikephil.charting.utils.Utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class LocalRouteParameters extends NAParameters implements RouteParameters {
    private long mNativePtr;
    private SpatialReference mSpatialReference;
    private NAFeaturesAsFeature mStops;
    private List<Graphic> mCachedStops = null;
    private List<Graphic> mCachedPointBarriers = null;
    private List<Graphic> mCachedPolylineBarriers = null;
    private List<Graphic> mCachedPolygonBarriers = null;
    private boolean mReturnRoutes = true;
    private boolean mReturnStops = false;
    private boolean mIgnoreInvalid = true;

    private native void clearInput(long j, int i);

    private native void dispose(long j);

    private native String[] getAccumulateAttributeNames(long j);

    private native String getDirectionsLanguage(long j);

    private native String getDirectionsLengthUnit(long j);

    private native String getDirectionsStyleName(long j);

    private native String getDirectionsTimeAttributeName(long j);

    private native boolean getFindBestSequence(long j);

    private native String getImpedanceAttributeName(long j);

    private native String getInSpatialReference(long j);

    private native String getOutSpatialReference(long j);

    private native String getOutputLines(long j);

    private native Graphic[] getPointBarriers(long j);

    private native Graphic[] getPolygonBarriers(long j);

    private native Graphic[] getPolylineBarriers(long j);

    private native boolean getPreserveFirstStop(long j);

    private native boolean getPreserveLastStop(long j);

    private native String getRestrictUTurns(long j);

    private native String[] getRestrictionAttributeNames(long j);

    private native boolean getReturnDirections(long j);

    private native long getStartTime(long j);

    private native Graphic[] getStops(long j);

    private native boolean getUseHierarchy(long j);

    private native boolean getUseTimeWindows(long j);

    private native void setAccumulateAttributeNames(long j, String[] strArr);

    private native void setAttributeParameterValues(long j, String[] strArr);

    private native void setBearingAndBearingTolerance(long j, double d, double d2);

    private native void setDirectionsLanguage(long j, String str);

    private native void setDirectionsLengthUnit(long j, String str);

    private native void setDirectionsStyleName(long j, String str);

    private native void setDirectionsTimeAttributeName(long j, String str);

    private native void setFindBestSequence(long j, boolean z);

    private native void setImpedanceAttributeName(long j, String str);

    private native void setInSpatialReference(long j, String str);

    private native void setNavigationLatencyAndSpeed(long j, double d, double d2);

    private native void setOutSpatialReference(long j, String str);

    private native void setOutputLines(long j, String str);

    private native void setPointBarrier(long j, double d, double d2, int i, int i2, String[] strArr, double[] dArr);

    private native void setPolygonBarrier(long j, byte[] bArr, int i, String[] strArr, double[] dArr);

    private native void setPolylineBarrier(long j, byte[] bArr, int i, String[] strArr, double[] dArr);

    private native void setPreserveFirstStop(long j, boolean z);

    private native void setPreserveLastStop(long j, boolean z);

    private native void setRestrictUTurns(long j, String str);

    private native void setRestrictionAttributeNames(long j, String[] strArr);

    private native void setReturnDirections(long j, boolean z);

    private native void setStartTime(long j, long j2);

    private native void setStop(long j, double d, double d2, String str, String[] strArr, double[] dArr, int i, long j2, long j3);

    private native void setUseHierarchy(long j, boolean z);

    private native void setUseTimeWindows(long j, boolean z);

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setDirectionsOutputType(DirectionsOutputType directionsOutputType) {
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public LocalRouteParameters(long j) {
        this.mSpatialReference = null;
        this._params = new e();
        this.mNativePtr = j;
        this.mSpatialReference = SpatialReference.create(getInSpatialReference(j));
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public long getNativeHandle() {
        return this.mNativePtr;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public String getDirectionsLanguage() {
        return getDirectionsLanguage(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public DirectionsLengthUnit getDirectionsLengthUnit() {
        return DirectionsLengthUnit.valueOf(getDirectionsLengthUnit(this.mNativePtr));
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public String getDirectionsStyleName() {
        return getDirectionsStyleName(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public DirectionsOutputType getDirectionsOutputType() {
        return DirectionsOutputType.COMPLETE;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean getFindBestSequence() {
        return getFindBestSequence(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean getIgnoreInvalidLocations() {
        return this.mIgnoreInvalid;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean getPreserveFirstStop() {
        return getPreserveFirstStop(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean getPreserveLastStop() {
        return getPreserveLastStop(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public Date getStartTime() {
        long startTime = getStartTime(this.mNativePtr);
        if (startTime == 0) {
            return null;
        }
        return new Date(startTime);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public NAFeatures getStops() {
        return this.mStops;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Graphic[] cloneStops() {
        return getStops(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean getUseTimeWindows() {
        return getUseTimeWindows(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean isReturnDirections() {
        return getReturnDirections(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean isReturnRoutes() {
        return this.mReturnRoutes;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public boolean isReturnStops() {
        return this.mReturnStops;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setDirectionsLanguage(String str) {
        setDirectionsLanguage(this.mNativePtr, str);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setDirectionsLengthUnit(DirectionsLengthUnit directionsLengthUnit) {
        setDirectionsLengthUnit(this.mNativePtr, directionsLengthUnit.name());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setDirectionsStyleName(String str) {
        setDirectionsStyleName(this.mNativePtr, str);
    }

    public void setDirectionsTimeAttributeName(String str) {
        setDirectionsTimeAttributeName(this.mNativePtr, str);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setFindBestSequence(Boolean bool) {
        setFindBestSequence(this.mNativePtr, bool.booleanValue());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setIgnoreInvalidLocations(Boolean bool) {
        this.mIgnoreInvalid = bool.booleanValue();
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setPreserveFirstStop(Boolean bool) {
        setPreserveFirstStop(this.mNativePtr, bool.booleanValue());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setPreserveLastStop(Boolean bool) {
        setPreserveLastStop(this.mNativePtr, bool.booleanValue());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setReturnDirections(boolean z) {
        setReturnDirections(this.mNativePtr, z);
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setReturnRoutes(boolean z) {
        this.mReturnRoutes = z;
    }

    @Override // com.esri.core.tasks.na.NAParameters
    public boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public String[] getAccumulateAttributeNames() {
        return getAccumulateAttributeNames(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public AttributeParameterValue[] getAttributeParameterValues() {
        return super.getAttributeParameterValues();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public String getImpedanceAttributeName() {
        return getImpedanceAttributeName(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public SpatialReference getOutSpatialReference() {
        return SpatialReference.create(getOutSpatialReference(this.mNativePtr));
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public Double getOutputGeometryPrecision() {
        return super.getOutputGeometryPrecision();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public Unit.EsriUnit getOutputGeometryPrecisionUnits() {
        return super.getOutputGeometryPrecisionUnits();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public NAOutputLine getOutputLines() {
        return NAOutputLine.valueOf(getOutputLines(this.mNativePtr));
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public NAFeatures getPointBarriers() {
        return super.getPointBarriers();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Graphic[] clonePointBarriers() {
        return getPointBarriers(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public NAFeatures getPolygonBarriers() {
        return super.getPolygonBarriers();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Graphic[] clonePolygonBarriers() {
        return getPolygonBarriers(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public NAFeatures getPolylineBarriers() {
        return super.getPolylineBarriers();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public Graphic[] clonePolylineBarriers() {
        return getPolylineBarriers(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public UTurnRestriction getRestrictUTurns() {
        return UTurnRestriction.valueOf(getRestrictUTurns(this.mNativePtr));
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public String[] getRestrictionAttributeNames() {
        return getRestrictionAttributeNames(this.mNativePtr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public Boolean getUseHierarchy() {
        return Boolean.valueOf(getUseHierarchy(this.mNativePtr));
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public int hashCode() {
        return super.hashCode();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public boolean isReturnPointBarriers() {
        return super.isReturnPointBarriers();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public boolean isReturnPolygonBarriers() {
        return super.isReturnPolygonBarriers();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public boolean isReturnPolylineBarriers() {
        return super.isReturnPolylineBarriers();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public boolean isReturnZ() {
        return super.isReturnZ();
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setAccumulateAttributeNames(String[] strArr) {
        super.setAccumulateAttributeNames(strArr);
        setAccumulateAttributeNames(this.mNativePtr, strArr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setAttributeParameterValues(AttributeParameterValue[] attributeParameterValueArr) {
        super.setAttributeParameterValues(attributeParameterValueArr);
        if (attributeParameterValueArr == null || attributeParameterValueArr.length == 0) {
            setAttributeParameterValues(this.mNativePtr, null);
            return;
        }
        String[] strArr = new String[attributeParameterValueArr.length * 3];
        int length = attributeParameterValueArr.length;
        int i = 0;
        int i2 = 0;
        while (i < length) {
            AttributeParameterValue attributeParameterValue = attributeParameterValueArr[i];
            int i3 = i2 + 1;
            strArr[i2] = attributeParameterValue.getAttributeName();
            int i4 = i3 + 1;
            strArr[i3] = attributeParameterValue.getParameterName();
            strArr[i4] = attributeParameterValue.getValue();
            i++;
            i2 = i4 + 1;
        }
        setAttributeParameterValues(this.mNativePtr, strArr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setImpedanceAttributeName(String str) {
        super.setImpedanceAttributeName(str);
        setImpedanceAttributeName(this.mNativePtr, str);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setOutSpatialReference(SpatialReference spatialReference) {
        super.setOutSpatialReference(spatialReference);
        setOutSpatialReference(this.mNativePtr, spatialReference.getText());
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setOutputGeometryPrecision(Double d) {
        super.setOutputGeometryPrecision(d);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setOutputGeometryPrecisionUnits(Unit.EsriUnit esriUnit) {
        super.setOutputGeometryPrecisionUnits(esriUnit);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setOutputLines(NAOutputLine nAOutputLine) {
        super.setOutputLines(nAOutputLine);
        setOutputLines(this.mNativePtr, nAOutputLine.name());
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setPointBarriers(NAFeatures nAFeatures) {
        if (!(nAFeatures instanceof NAFeaturesAsFeature)) {
            super.setPointBarriers(null);
            this.mCachedPointBarriers = null;
            clearInput(this.mNativePtr, 1);
            return;
        }
        NAFeaturesAsFeature nAFeaturesAsFeature = (NAFeaturesAsFeature) nAFeatures;
        List<Graphic> features = nAFeaturesAsFeature.getFeatures();
        List<Graphic> list = this.mCachedPointBarriers;
        boolean z = list == null;
        if (list != null) {
            z = (list.size() == features.size() && this.mCachedPointBarriers.equals(features)) ? false : true;
        }
        if (z) {
            super.setPointBarriers(nAFeatures);
            this.mCachedPointBarriers = new ArrayList(features);
            clearInput(this.mNativePtr, 1);
            for (Graphic graphic : features) {
                Geometry geometry = graphic.getGeometry();
                if (geometry instanceof Point) {
                    if (nAFeaturesAsFeature.getSpatialReference() != null && !nAFeaturesAsFeature.getSpatialReference().getText().equals(this.mSpatialReference.getText())) {
                        geometry = GeometryEngine.project(geometry, nAFeaturesAsFeature.getSpatialReference(), this.mSpatialReference);
                    }
                    Point point = (Point) geometry;
                    ArrayList arrayList = new ArrayList();
                    ArrayList arrayList2 = new ArrayList();
                    int i = 0;
                    int i2 = 0;
                    for (Map.Entry<String, Object> entry : graphic.getAttributes().entrySet()) {
                        String key = entry.getKey();
                        Object value = entry.getValue();
                        if ("CurbApproach".equalsIgnoreCase(key)) {
                            int intValue = value == null ? 0 : ((Integer) value).intValue();
                            i = intValue == 1 ? 2 : intValue == 2 ? 1 : intValue;
                        } else if ("BarrierType".equalsIgnoreCase(key)) {
                            int intValue2 = value == null ? 0 : ((Integer) value).intValue();
                            i2 = intValue2 == 2 ? 1 : intValue2;
                        } else if ("Attr_".regionMatches(true, 0, key, 0, 5)) {
                            arrayList.add(key.substring(5));
                            arrayList2.add(Double.valueOf(value == null ? Utils.DOUBLE_EPSILON : ((Double) value).doubleValue()));
                        }
                    }
                    double[] dArr = new double[arrayList2.size()];
                    for (int i3 = 0; i3 < arrayList2.size(); i3++) {
                        dArr[i3] = ((Double) arrayList2.get(i3)).doubleValue();
                    }
                    setPointBarrier(this.mNativePtr, point.getX(), point.getY(), i, i2, (String[]) arrayList.toArray(new String[arrayList.size()]), dArr);
                }
            }
        }
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setPolygonBarriers(NAFeatures nAFeatures) {
        int i;
        if (!(nAFeatures instanceof NAFeaturesAsFeature)) {
            super.setPolygonBarriers(null);
            this.mCachedPolygonBarriers = null;
            clearInput(this.mNativePtr, 3);
            return;
        }
        NAFeaturesAsFeature nAFeaturesAsFeature = (NAFeaturesAsFeature) nAFeatures;
        List<Graphic> features = nAFeaturesAsFeature.getFeatures();
        List<Graphic> list = this.mCachedPolygonBarriers;
        boolean z = true;
        boolean z2 = list == null;
        if (list != null) {
            if (list.size() == features.size() && this.mCachedPolygonBarriers.equals(features)) {
                z = false;
            }
            z2 = z;
        }
        if (z2) {
            super.setPolygonBarriers(nAFeatures);
            this.mCachedPolygonBarriers = new ArrayList(features);
            clearInput(this.mNativePtr, 3);
            for (Graphic graphic : features) {
                Geometry geometry = graphic.getGeometry();
                if (geometry instanceof Polygon) {
                    if (nAFeaturesAsFeature.getSpatialReference() != null && !nAFeaturesAsFeature.getSpatialReference().getText().equals(this.mSpatialReference.getText())) {
                        geometry = GeometryEngine.project(geometry, nAFeaturesAsFeature.getSpatialReference(), this.mSpatialReference);
                    }
                    byte[] geometryToEsriShape = GeometryEngine.geometryToEsriShape(geometry);
                    ArrayList arrayList = new ArrayList();
                    ArrayList arrayList2 = new ArrayList();
                    while (true) {
                        i = 0;
                        for (Map.Entry<String, Object> entry : graphic.getAttributes().entrySet()) {
                            String key = entry.getKey();
                            Object value = entry.getValue();
                            if ("BarrierType".equalsIgnoreCase(key)) {
                                if (value == null) {
                                    break;
                                }
                                i = ((Integer) value).intValue();
                            } else if ("Attr_".regionMatches(true, 0, key, 0, 5)) {
                                arrayList.add(key.substring(5));
                                arrayList2.add(Double.valueOf(value == null ? 1.0d : ((Double) value).doubleValue()));
                            }
                        }
                    }
                    double[] dArr = new double[arrayList2.size()];
                    for (int i2 = 0; i2 < arrayList2.size(); i2++) {
                        dArr[i2] = ((Double) arrayList2.get(i2)).doubleValue();
                    }
                    setPolygonBarrier(this.mNativePtr, geometryToEsriShape, i, (String[]) arrayList.toArray(new String[arrayList.size()]), dArr);
                }
            }
        }
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setPolylineBarriers(NAFeatures nAFeatures) {
        int i;
        if (!(nAFeatures instanceof NAFeaturesAsFeature)) {
            super.setPolylineBarriers(null);
            this.mCachedPolylineBarriers = null;
            clearInput(this.mNativePtr, 2);
            return;
        }
        NAFeaturesAsFeature nAFeaturesAsFeature = (NAFeaturesAsFeature) nAFeatures;
        List<Graphic> features = nAFeaturesAsFeature.getFeatures();
        List<Graphic> list = this.mCachedPolylineBarriers;
        boolean z = true;
        boolean z2 = list == null;
        if (list != null) {
            if (list.size() == features.size() && this.mCachedPolylineBarriers.equals(features)) {
                z = false;
            }
            z2 = z;
        }
        if (z2) {
            super.setPolylineBarriers(nAFeatures);
            this.mCachedPolylineBarriers = new ArrayList(features);
            clearInput(this.mNativePtr, 2);
            for (Graphic graphic : features) {
                Geometry geometry = graphic.getGeometry();
                if (geometry instanceof Polyline) {
                    if (nAFeaturesAsFeature.getSpatialReference() != null && !nAFeaturesAsFeature.getSpatialReference().getText().equals(this.mSpatialReference.getText())) {
                        geometry = GeometryEngine.project(geometry, nAFeaturesAsFeature.getSpatialReference(), this.mSpatialReference);
                    }
                    byte[] geometryToEsriShape = GeometryEngine.geometryToEsriShape(geometry);
                    ArrayList arrayList = new ArrayList();
                    ArrayList arrayList2 = new ArrayList();
                    while (true) {
                        i = 0;
                        for (Map.Entry<String, Object> entry : graphic.getAttributes().entrySet()) {
                            String key = entry.getKey();
                            Object value = entry.getValue();
                            if ("BarrierType".equalsIgnoreCase(key)) {
                                if (value == null) {
                                    break;
                                }
                                i = ((Integer) value).intValue();
                            } else if ("Attr_".regionMatches(true, 0, key, 0, 5)) {
                                arrayList.add(key.substring(5));
                                arrayList2.add(Double.valueOf(value == null ? 1.0d : ((Double) value).doubleValue()));
                            }
                        }
                    }
                    double[] dArr = new double[arrayList2.size()];
                    for (int i2 = 0; i2 < arrayList2.size(); i2++) {
                        dArr[i2] = ((Double) arrayList2.get(i2)).doubleValue();
                    }
                    setPolylineBarrier(this.mNativePtr, geometryToEsriShape, i, (String[]) arrayList.toArray(new String[arrayList.size()]), dArr);
                }
            }
        }
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setRestrictUTurns(UTurnRestriction uTurnRestriction) {
        super.setRestrictUTurns(uTurnRestriction);
        setRestrictUTurns(this.mNativePtr, uTurnRestriction.name());
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setRestrictionAttributeNames(String[] strArr) {
        super.setRestrictionAttributeNames(strArr);
        setRestrictionAttributeNames(this.mNativePtr, strArr);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setReturnPointBarriers(boolean z) {
        super.setReturnPointBarriers(z);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setReturnPolygonBarriers(boolean z) {
        super.setReturnPolygonBarriers(z);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setReturnPolylineBarriers(boolean z) {
        super.setReturnPolylineBarriers(z);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setReturnZ(boolean z) {
        super.setReturnZ(z);
    }

    @Override // com.esri.core.tasks.na.NAParameters, com.esri.core.tasks.na.RouteParameters
    public void setUseHierarchy(Boolean bool) {
        super.setUseHierarchy(bool);
        setUseHierarchy(this.mNativePtr, bool.booleanValue());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setReturnStops(boolean z) {
        this.mReturnStops = z;
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setStartTime(Date date) {
        setStartTime(this.mNativePtr, date == null ? 0L : date.getTime());
    }

    private static Double getDouble(Object obj) {
        if (obj instanceof Number) {
            return Double.valueOf(((Number) obj).doubleValue());
        }
        return null;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // com.esri.core.tasks.na.RouteParameters
    public void setStops(NAFeatures nAFeatures) {
        String str;
        String str2 = null;
        if (!(nAFeatures instanceof NAFeaturesAsFeature)) {
            this.mStops = null;
            this.mCachedStops = null;
            clearInput(this.mNativePtr, 0);
            return;
        }
        NAFeaturesAsFeature nAFeaturesAsFeature = (NAFeaturesAsFeature) nAFeatures;
        List<Graphic> features = nAFeaturesAsFeature.getFeatures();
        List<Graphic> list = this.mCachedStops;
        int i = 1;
        boolean z = list == null;
        if (list != null) {
            z = (list.size() == features.size() && this.mCachedStops.equals(features)) ? false : true;
        }
        if (z) {
            this.mStops = nAFeaturesAsFeature;
            this.mCachedStops = new ArrayList(features);
            clearInput(this.mNativePtr, 0);
            boolean z2 = true;
            for (Graphic graphic : features) {
                Geometry geometry = graphic.getGeometry();
                if (geometry instanceof Point) {
                    if (this.mStops.getSpatialReference() != null && !this.mStops.getSpatialReference().getText().equals(this.mSpatialReference.getText())) {
                        geometry = GeometryEngine.project(geometry, this.mStops.getSpatialReference(), this.mSpatialReference);
                    }
                    Point point = (Point) geometry;
                    ArrayList arrayList = new ArrayList();
                    ArrayList arrayList2 = new ArrayList();
                    long j = 0;
                    long j2 = 0;
                    String str3 = str2;
                    Double d = str3;
                    Double d2 = d;
                    Double d3 = d2;
                    Double d4 = d3;
                    int i2 = 0;
                    for (Map.Entry<String, Object> entry : graphic.getAttributes().entrySet()) {
                        String key = entry.getKey();
                        Object value = entry.getValue();
                        if ("CurbApproach".equalsIgnoreCase(key)) {
                            int intValue = value == null ? 0 : ((Integer) value).intValue();
                            i2 = intValue == i ? 2 : intValue == 2 ? 1 : intValue;
                        } else if ("Name".equalsIgnoreCase(key)) {
                            str3 = (String) value;
                        } else if ("TimeWindowStart".equalsIgnoreCase(key)) {
                            j = value == null ? 0L : ((Long) value).longValue();
                        } else if ("TimeWindowEnd".equalsIgnoreCase(key)) {
                            j2 = value == null ? 0L : ((Long) value).longValue();
                        } else if ("Attr_".regionMatches(true, 0, key, 0, 5)) {
                            arrayList.add(key.substring(5));
                            arrayList2.add(Double.valueOf(value == null ? Utils.DOUBLE_EPSILON : ((Double) value).doubleValue()));
                        } else if ("Bearing".equalsIgnoreCase(key) && z2) {
                            d = getDouble(value);
                        } else if ("BearingTol".equalsIgnoreCase(key) && z2) {
                            d2 = getDouble(value);
                        } else if ("NavLatencySec".equalsIgnoreCase(key) && z2) {
                            d4 = getDouble(value);
                        } else if ("NavSpeedMetersPerSec".equalsIgnoreCase(key) && z2) {
                            d3 = getDouble(value);
                        }
                    }
                    double[] dArr = new double[arrayList2.size()];
                    for (int i3 = 0; i3 < arrayList2.size(); i3++) {
                        dArr[i3] = ((Double) arrayList2.get(i3)).doubleValue();
                    }
                    str = str2;
                    setStop(this.mNativePtr, point.getX(), point.getY(), str3, (String[]) arrayList.toArray(new String[arrayList.size()]), dArr, i2, j, j2);
                    if (z2 && d != 0 && d2 != null) {
                        setBearingAndBearingTolerance(this.mNativePtr, d.doubleValue(), d2.doubleValue());
                    }
                    if (z2 && d3 != null && d4 != null) {
                        setNavigationLatencyAndSpeed(this.mNativePtr, d4.doubleValue(), d3.doubleValue());
                    }
                } else {
                    str = str2;
                }
                str2 = str;
                i = 1;
                z2 = false;
            }
        }
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void setUseTimeWindows(Boolean bool) {
        setUseTimeWindows(this.mNativePtr, bool.booleanValue());
    }

    @Override // com.esri.core.tasks.na.RouteParameters
    public void dispose() {
        dispose(this.mNativePtr);
        this.mNativePtr = 0L;
    }

    protected void finalize() throws Throwable {
        dispose();
        super.finalize();
    }
}
